#ifndef OXYGENLANCEWIDGET_H
#define OXYGENLANCEWIDGET_H

#include <QWidget>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QFrame>
#include <QMap>
#include <QPainter>
#include "CommonContainer.h"

class OxygenLanceWidget : public CommonContainer
{
    Q_OBJECT

public:
    explicit OxygenLanceWidget(QString title, QWidget *parent = nullptr);
    ~OxygenLanceWidget();

    void setParameterValue(const QString &name, const QString &value);
    QString getParameterValue(const QString &name) const;

    void setEditMode(bool enabled);
    bool isEditMode() const;

signals:
    void parameterValueChanged(const QString &name, const QString &value);
    void editModeChanged(bool enabled);

protected:

private slots:
    void onValueChanged();
    void onEditButtonClicked();
    void onEditModeChanged(bool enabled);

private:
    void setupUI();
    void setupConnections();
    void addParameterItem(const QString &name, const QString &value = "");

    // 布局组件
    QVBoxLayout *m_contentLayout;
    
    // 参数项
    QMap<QString, QHBoxLayout*> m_parameterLayouts;
    QMap<QString, QLabel*> m_nameLabels;
    QMap<QString, QLineEdit*> m_valueEdits;
    
    // 状态
    bool m_isEditMode;
};

#endif // OXYGENLANCEWIDGET_H
